<!--
 * @Author: ShiJunJie
 * @Date: 2020-12-04 14:32:21
 * @LastEditors: ShiJunJie
 * @LastEditTime: 2022-04-01 14:38:07
 * @Descripttion: svg图标  <Iconfont name="(svgurl||iconfont)" />
-->
<template>
  <span class="anticon svg-icon" v-if="name">
    <svg class="icon" aria-hidden="true">
      <use :xlink:href="`#${name}`" />
    </svg>
  </span>
</template>
<!-- <MyIcon class="svg-icon" :type="iconfont" /> -->

<script setup>
import { createFromIconfontCN } from '@ant-design/icons-vue'

const MyIcon = createFromIconfontCN({
  //   //at.alicdn.com/t/font_2874356_hburnxc94qo.js
  scriptUrl: import.meta.env.VITE_ICONFONT, // 在 iconfont.cn 上生成
})

const props = defineProps({
  name: {
    type: String,
  },
})
</script>

<style lang="scss" scoped>
.svg-icon {
  display: inline-block;
  vertical-align: baseline;
  position: relative;
  width: 1em;
  height: 1em;
}
:deep(svg) {
  width: 1em;
  height: 1em;
  display: inline-block;
  fill: currentColor;
}
</style>
